package spring_annotation.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import spring_annotation.dao.BookDao;

import javax.annotation.Resource;

@Service
public class BookService {

//    @Autowired(required = false)
//    @Qualifier("bookDao3")
//    @Resource         //跟Autowired功能相似，但没有required = false,也不支持@Primary
//    @Inject           //跟Autowired功能相似，但没有required = false
    private BookDao bookDao;

    public void print(){
        System.out.println(bookDao);
    }

    @Override
    public String toString() {
        return "BookService{" +
                "bookDao=" + bookDao +
                '}';
    }
}
